# sum = 0
# for i in range(1,101):
#     sum += i
# print(sum)

# sum = 0
# for i in range(300,401):
#     sum += i
# print(sum)

# # 定义数列求和函数
# def calcSum(beg,end):
#     sum = 0
#     for i in range(beg,end + 1):
#         sum += i
#     print(sum)
#
# # 调用函数
# calcSum(1,100)
# calcSum(300,400)
# calcSum(1,1000)

# def test1():
#     print('hello')

# test3()
# def test3():
#     print('hello')

# def test(a,b,c):
#     print(a,b,c)
# test(1,2,3)

# def test(a):
#     print(a)
# test(10)
# test('hello')
# test(True)

# def calcSum(beg, end):
#     sum = 0
#     for i in range(beg, end + 1):
#         sum += i
#     return sum
#
# result = calcSum(1,100)
# print(result)

# def isOdd(num):
#     if num % 2 == 0:
#         return False
#     return True
#
# result = isOdd(10)
# print(result)

# def getPoint():
#     x = 10
#     y = 20
#     return x,y
#
# _,b = getPoint()

# def getPoint():
#     x = 10
#     y = 20
#     return x, y
#
# x, y = getPoint()

# def getPoint():
#     x = 10
#     y = 20
#     return x, y
#
# getPoint()
# print(x, y)

# x = 20
#
# def test():
#     x = 10
#     print(f'函数内部 x = {x}')
#
# test()
# print(f'函数外部 x = {x}')

# x = 20
#
# def test():
#     print(f'x = {x}')
#
# test()

# x = 20
#
# def test():
#     global x
#     x = 10
#     print(f'函数内部 x = {x}')
#
# test()
#
# print(f'函数外部 x = {x}')

# for i in range(1, 3):
#     print(f'函数内部 i = {i}')
#
# print(f'函数外部 i = {i}')

# def test():
#     print("执行函数内部代码")
#     print("执行函数内部代码")
#     print("执行函数内部代码")
#
# print("1111")
# test()
# print("2222")
# test()
# print("3333")

# # 判定是否是奇数
# def isOdd(num):
#     if num % 2 == 0:
#         return False
#     else:
#         return True
#
# result = isOdd(10)
# print(result)

# def a():
#     print("函数 a")
# def b():
#     print("函数 b")
#     a()
# def c():
#     print("函数 c")
#     b()
# def d():
#     print("函数 d")
#     c()
# d()


# def a():
#     print("函数 a")
# def b():
#     a()
#     print("函数 b")
# def c():
#     b()
#     print("函数 c")
# def d():
#     c()
#     print("函数 d")
# d()

# def a():
#     num1 = 10
#     print("函数 a")
# def b():
#     num2 = 20
#     a()
#     print("函数 b")
# def c():
#     num3 = 30
#     b()
#     print("函数 c")
# def d():
#     num4 = 40
#     c()
#     print("函数 d")
#
# d()

# def factor(n):
#     if n == 1:
#         return 1
#     return n * factor(n - 1)
#
# result = factor(5)
# print(result)

# def factor(n):
#     return n * factor(n - 1)
#
# result = factor(5)
# print(result)

# def add(x,y,debug = False):
#     if debug:
#         print(f'调试信息：x={x},y={y}')
#     return x + y
#
# print(add(10,20))
# print(add(10,20,True))

# def test(x, y):
#     print(f'x = {x}')
#     print(f'y = {y}')
#
# test(x=10, y=20)
# test(y=100, x=200)

# alist = [ ]
# alist = list()
#
# print(type(alist))

# alist = [1, 2, 3, 4]
# print(alist)

# alist = [1, 'hello', True]
# print(alist)

# alist = [1, 2, 3, 4]
# print(alist[2])

# alist = [1, 2, 3, 4]
# alist[2] = 100
# print(alist)

# alist = [1, 2, 3, 4]
# print(alist[10])

# alist = [1, 2, 3, 4]
# print(len(alist))

# alist = [1, 2, 3, 4]
# print(alist[3])
# print(alist[-1])

# alist = [1, 2, 3, 4]
# print(alist[1:3])

# alist = [1, 2, 3, 4]
# print(alist[1:])    # 省略后边界, 表示获取到列表末尾
# print(alist[:-1])   # 省略前边界, 表示从列表开头获取
# print(alist[:])     # 省略两个边界, 表示获取到整个列表

# alist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# print(alist[::1])
# print(alist[::2])
# print(alist[::3])
# print(alist[::5])

# alist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# print(alist[::-1])
# print(alist[::-2])
# print(alist[::-3])
# print(alist[::-5])

# alist = [1, 2, 3, 4]
# print(alist[100:200])

# alist = [1, 2, 3, 4]
# for i in alist:
#     print(i)

# alist = [1, 2, 3, 4]
# for i in range(0, len(alist)):
#     print(alist[i])

# alist = [1,2,3,4]
# i = 0
# while i < len(alist):
#     print(alist[i])
#     i += 1

# alist = [1,2,3,4]
# alist.append('hello')
# print(alist)

# alist = [1,2,3,4]
# alist.insert(1, 'hello')
# print(alist)

# alist = [1,2,3,4]
# print(2 in alist)
# print(10 in alist)

# alist = [1,2,3,4]
# print(alist.index(2))
# print(alist.index(4))

# alist = [1,2,3,4]
# alist.remove(2)
# print(alist)

# alist = [1,2,3,4]
# blist = [5,6,7]
# print(alist + blist)

# alist = [1, 2, 3, 4]
# blist = [5, 6, 7]
# alist.extend(blist)
# print(alist)
# print(blist)

# def getPoint():
#     return 10, 20
#
# result = getPoint()
# print(type(result))